import React,{PureComponent} from 'react'
import './App.css'
class App extends PureComponent{
    handClick=(e)=>{
        e.preventDefault()
    }
    componentDidMount(){
        const  html=`
            <ul>
                <li>科技</li>
                <li>生活</li>
                <li>教育</li>
                <li>新闻</li>
                <li>活动</li>
                <li>体育</li>
            </ul>
        `
        document.oncontextmenu=function(e){
            e=e || window.event
            e.preventDefault ? e.preventDefault() : e.returnValue=false
            document.body.innerHTML=''
            let div=document.createElement('div')
            div.innerHTML=html
            div.style.position='absolute'
            div.style.left=e.clientX+'px'
            div.style.top=e.clientY+'px'
            document.body.appendChild(div)
        }
    }
    render(){
        return(
            <React.Fragment>
                <a href="https://www.baidu.com/" onClick={this.handClick}>baidu</a>
                
            </React.Fragment>
        )
    }
}
export default App